<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/commons/taglibs.jsp" %>

<rapid:override name="head">
	<title>Book新增</title>
</rapid:override>

<rapid:override name="content">
	<div class="navigation">Book > 新增</div>
	<form:form method="post" action="${ctx}/book" modelAttribute="book" class="form-horizontal">
		<div class="handleControl">
		<input id="submitButton" class="btn btn-default" name="submitButton" type="button" value="提交" "/>
		<input type="button" class="btn btn-default" value="返回列表" onclick="window.location='${ctx}/book'"/>
		<input type="button" class="btn btn-default" value="后退" onclick="history.back();"/></div>
		<div class="gridTable">
		<table width="100%"  border="0" cellspacing="0" class="table text-center">
			<%@ include file="form_include.jsp" %>
		</table>
		</div>
	</form:form>
	
	<script>
		
		new Validation(document.forms[0],{onSubmit:true,onFormValidate : function(result,form) {
			var finalResult = result;
			
			//在这里添加自定义验证			
			return disableSubmit(finalResult,'submitButton');
		}});

		
	</script>
	
	<style type="text/css">
		span.required{
			color:red;
			font-weight: bold;
		}
		input.required, textarea.required {
			border: 1px solid #00A8E6;
		}
	</style>
</rapid:override>
<rapid:override name="script">
	<script>
	var picker1 = new Pikaday(
		    {
		        field: document.getElementById('birthString'),
		        firstDay: 1,
		        minDate: new Date('1900-01-01'),
		        maxDate: new Date('2020-12-31'),
		        yearRange: [1900,2020]
		    });
	var picker2 = new Pikaday(
		    {
		        field: document.getElementById('createTimeString'),
		        firstDay: 1,
		        minDate: new Date('1900-01-01'),
		        maxDate: new Date('2020-12-31'),
		        yearRange: [1900,2020]
		    });
    
	function checkPassWordConfirm(continueFlag){ 	
		var userPasswordConfirm = $.trim($("#confirmPassword").val());
		if(userPasswordConfirm != null && userPasswordConfirm.length != 0){
			var userPassword = $.trim($("#password").val());
			if(userPassword != userPasswordConfirm){
				continueFlag = false;
				$(".prompt").html("<font color=\"red\">两次输入密码不一致！请重新输入！</font>"); 
				$("#userPasswordConfirm").attr("value",""); 
				$("#userPasswordConfirm").focus().select();
			}else{
				$(".promp").html(""); 
			}
		}else{
			continueFlag = false;
			$(".prompt").html("<font color=\"red\">请输入重复密码！</font>"); 
			$("#userPasswordConfirm").focus().select();
		}
			
		if(continueFlag)
			document.forms[0].submit(); 
	}
</script>
</rapid:override>
<%@ include file="base.jsp" %>
